<%def name="ws(x=1)">
% for i in range(x):
&nbsp;&nbsp;
% endfor
</%def>

<script type="text/javascript">
var test = 0;
function appendPage(url,id) {
    //Insert the html returned from URL in the span with id 'id'
    var xmlhttp;
    if (window.XMLHttpRequest) {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    } else {
    // code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function() {
        if(xmlhttp.readyState==4) {
            
            document.getElementById(id+test).innerHTML+=xmlhttp.responseText+"<div id='"+id+(test+1)+"></div>";
            test++;
        }
    }
    xmlhttp.open("GET",url+"?number="+test,true);
    xmlhttp.send(null);
}

function replacePage(url,id) {
    //Insert the html returned from URL in the span with id 'id'
    var xmlhttp;
    if (window.XMLHttpRequest) {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    } else {
    // code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function() {
        if(xmlhttp.readyState==4) {
            document.getElementById(id).innerHTML=xmlhttp.responseText;
        }
    }
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
}



function getPage(url,id) {
    //Insert the html returned from URL in the span with id 'id'
    var xmlhttp;
    if (window.XMLHttpRequest) {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    } else {
    // code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function() {
        if(xmlhttp.readyState==4) {
            document.getElementById(id).innerHTML=xmlhttp.responseText;
        }
    }
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
}

function newClient() {
    document.getElementById("space").innerHTML = "<input type=button value='Nuevo Individuo' onclick=getPage('/tables_admin/new/client_data?basichtml=True','space')><input type=button value='Nueva Empresa' onclick=getPage('/tables_admin/new/company?basichtml=True','space')>"
}

function setInnerHtml(id,str) {
    document.getElementById(id).innerHTML=str
}

function filterProduct(f,url,id) {
  getPage(url+"?name="+f.name.value+"&personal_id="+f.personal_id.value+"&telephone="+f.telephone.value,id)
}

appendPage('/tables_admin/new/line','line');

</script>


<%inherit file="base.mako" />

<form name="insert" action="" method="get">
   <input type=hidden name=Contract--account_id value=${account_id}>
   <input type=hidden name=Contract--agent_id value=${agent_id}>
   <input type=hidden name=account_id value=${account_id}>
   
  <table>


<tr>
  <td>
    <div id=contract>
        <h3>Contrato</h3>
        ${fs.render()}            
    </div>
  </td>
</tr>
<tr>
  <td>
        
&nbsp;&nbsp;&nbsp;&nbsp;   
<div id=line>
    <div id=line0>
    
    </div>
 </div>
<input type=button name="add_line" value="Agregar Otra Linea al Contrato" onclick=" appendPage('/tables_admin/new/line','line');">

  </td>
</tr>
</table>
<input type=submit name=submit value=Crear>

</form>
 